package com.such.kit.validate.validator.exception;

import java.util.List;
import com.such.kit.validate.ValidateCommons;

public class CheckParamsException extends RuntimeException {

	private static final long serialVersionUID = 2044145396617813949L;
	private String message;

	public String getMessage() {
		return this.message;
	}

	public CheckParamsException(String validator, List<String> params) {
		super();
		StringBuffer message = new StringBuffer();
		message.append("参数列表");
		if (ValidateCommons.isEmpty(params)) {
			message.append("为空");
		} else {
			message.append("：[");
			int index = 0;
			for (String param : params) {
				if (index > 0) {
					message.append(", ");
				}
				message.append(param);
				index++;
			}
			message.append("]");
		}
		message.append("，与校验器 [").append(validator).append("] 不匹配");
		this.message = message.toString();
	}

}
